package com.huawei.hms.support.api.client;

import android.app.Activity;
import android.util.Log;
import com.huawei.hms.common.internal.Preconditions;

@Deprecated
public abstract class ResolvingResultCallbacks<R extends Result> extends ResultCallbacks<R> {
    private final Activity a;
    private final int b;

    public abstract void onSuccess(R r);

    public abstract void onUnresolvableFailure(Status status);

    protected ResolvingResultCallbacks(Activity activity, int i) {
        this.a = (Activity) Preconditions.checkNotNull(activity, "Activity must not be null");
        this.b = i;
    }

    public final void onFailure(Status status) {
        if (status.hasResolution()) {
            try {
                status.startResolutionForResult(this.a, this.b);
                return;
            } catch (Throwable th) {
                Log.e("ResolvingResultCallback", "Failed to start resolution", th);
                onUnresolvableFailure(new Status(8));
                return;
            }
        }
        onUnresolvableFailure(status);
    }
}
